package reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class Test3 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Class  cls=Class.forName("reflect.Student");

        Constructor c=cls.getConstructor();//无参
        Object o =c.newInstance();
        System.out.println(o);


        Constructor c2=cls.getConstructor(String.class,int.class,char.class);
        Object o2=c2.newInstance("李四",19,'男');//new Person("李四",19)
        System.out.println(o2);

    }
}

